import { CUSTOM_ELEMENTS_SCHEMA, NgModule, } from '@angular/core'
import { RouterModule } from '@angular/router'
import { APP_BASE_HREF, CommonModule } from '@angular/common'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'

import { SharedModule } from './shared/shared.module'

import { RoutesRoutingModule } from './routes/routes-routing.module'
import { AppComponent } from './app.component'
import { LoginComponent } from './views/login/login.component'

import { environment } from '@/environments/environment'
import { LayoutModule } from './layout/layout.module'
import { IconDefinition } from '@ant-design/icons-angular'
import { NzIconModule } from 'ng-zorro-antd/icon'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'

// 引入全部的图标，不推荐
import * as AllIcons from '@ant-design/icons-angular/icons'

const antDesignIcons = AllIcons as {
  [key: string]: IconDefinition;
}
const icons: IconDefinition[] = Object.keys(antDesignIcons).map(key => antDesignIcons[key])

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
  ],
  imports: [
    CommonModule,
    RouterModule,
    FormsModule,
    SharedModule,
    ReactiveFormsModule,
    RoutesRoutingModule,
    BrowserAnimationsModule,
    NzIconModule.forRoot(icons),
    LayoutModule,
  ],
  providers: [
    { provide: APP_BASE_HREF, useValue: environment.APP_BASE_HREF }
  ],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule { }
